   <!DOCTYPE html>
<html>
<head>
<head />
<div th:include="base-libs :: base-libs" />
<title>服务讨论</title>
<style type="text/css">
.topBtn{
	float: right;
	margin-right:10px;
	margin-top:5px
}

</style>
</head>
<script th:inline="javascript">
	/**医联体信息*/
	var qysqxx = [[${qysqxx}]];
	/**用户信息*/
	var userInfo = [[${userInfo}]];
	/**服务管理信息*/
	var fwglxx = [[${fwglxx}]];
	/**讨论记录*/
	var tljl = [[${tljl}]];
</script>
<script type="text/javascript">
	$(function() {
		initData();
		initView();
	});

	function initData() {
		/**加载医联体信息*/
		initQysqxx();
		/**加载提供服务机构信息*/
		if(userInfo){
			$("#YSID").val(userInfo["USERID"]);
			$("#YSXM").val(userInfo["XM"]);
			$("#YLJGMC").val(userInfo["YLJGMC"]);
			$("#YLJGID").val(userInfo["YLJGID"]);
			var date = new Date();
			$("#TLSJ").val(date.getFullYear()+"-"+(date.getMonth() + 1)+"-"+date.getDate());
		}
		
		/**服务管理信息*/
		if(fwglxx){
			$(".fwgl").each(function(){
				$(this).text(fwglxx[$(this).attr("id")]);
			});
			if(fwglxx["XZBL"]=="0"){
				$("#BLTR").hide();
			}else if(fwglxx["XZBL"]=="1"){
				$("#BLTR").show();
				$("#BLXZ").text(fwglxx["HZXM"]+"\t"+fwglxx["ZDMC"]);
			}
			$("#JSFWJG").text(fwglxx["JSFWJG"]).attr("title",fwglxx["JSFWJG"]);
			$("#FWGLID").val(fwglxx["FWGLID"]);
			$("#TGFWJGMC").text(fwglxx["TGFWJGMC"]);
			$("#FWGLID").val(fwglxx["FWGLID"]);
		}
		if(tljl){
			var tljls = [];
			var num = 0;
			var re = 0;
			$(tljl).each(function(index, item){
				var ob = $($("#tljl").html());
				ob.find(".YSXM").text(item["YSXM"]);
				ob.find(".YLJGMC ").text(item["YLJGMC"]);
				ob.find(".TLSJ").text(item["TLSJ"]);
				ob.find(".TLNR").text(item["TLNR"]);
				if(StringUtils.isEmpty(item["TLBZ"])){
					ob.find(".bzTr").remove();
					re +=40;
				}else{
					ob.find(".TLBZ").text(item["TLBZ"]);
				}
				tljls.push(ob);
				num+=1;
			});
			$("#maxDiv").css("height",num*150+610-re+"px");
			$("#maxLayout").layout("resize");
			console.log(tljls);
			$(".tlTable").before(tljls);
		}
		 
	}

	function initView(){
		/**提交按钮*/
		$("#btnSave").on("click", function(){
			if($(".form-control").QuickValidate()){
				var params = {};
				/* params["YLJGIDS"] = $("#JSFWJG").combobox("getValues");
				params["YQFWSJ"] = $("#YQFWSJ").val();
				params["BLID"] = $("#BLID").val(); */
				$.QuickRemote.AjaxFiledFormSubmit("managerForm", function(result) { 
					var info = result["info"];
					if (result["state"]) {
						$.QuickAlert.alertNormal("保存讨论记录成功！",{callback: function(){
							$.QuickUrlUtils.redirectUrl("index.html");
						}});
					} else {
						$.QuickAlert.alertFail({
							content : info["faultInfo"]
						});
					}
				}, params);
			}
		});
	}
	
	/**返回按钮*/
	function btnBackHandler() {
		$.QuickUrlUtils.redirectUrl("index.html");
	}
	
	/**加载医联体信息*/
	function initQysqxx(){
		if(qysqxx){
			$(".yltxx").each(function(){
				$(this).text(qysqxx[$(this).attr("id")]);
			});
		}
	}
</script>

<body style="overflow-y: scroll">
<div id="maxDiv" style="height: 610px;">
	<div id="maxLayout" class="easyui-layout" fit="true">
		<div region="center" style="border: none; overflow: hidden;">
			<h4 class="h4-title" style="font-size: 18px;text-align:center;">
				新建服务
			</h4>
			<div class="form-table-box" >
				<form id="managerForm" class="form-horizontal" action="save">
					<h4 class="h4-title" style="font-size: 13px;">
						医联体信息
					</h4>
					<table class="form-table">
						<tr>
							<td class="td-text">医联体名称：</td>
							<td class="td-content">
								<span id="YLTMC" class="yltxx" type="text">
								</span>
							</td>
							<td class="td-text">医联体类型：</td>
							<td class="td-content">
								<span id="YLTLXMC" class="yltxx"></span>
							</td>
							<td class="td-text">主导医疗机构：</td>
							<td class="td-content">
								<span id="ZDYLJGMC" class="yltxx"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">签约有效期：</td>
							<td class="td-content">
								<span id="QYYXQMC" class="yltxx"></span>
							</td>
							<td class="td-text">签约时间：</td>
							<td class="td-content">
								<span id="QYSJ" class="yltxx"></span>
							</td>
							<td class="td-text">至</td>
							<td class="td-content">
								<span id="DQSJ" class="yltxx"></span>
							</td> 
						</tr>
					</table>
					<h4 class="h4-title" style="font-size: 13px;">
						服务信息
					</h4>
					<table class="form-table ">
						<tr>
							<td class="td-text">提供服务机构：</td>
							<td class="td-content">
								<span id="TGFWJGMC"></span>
							</td>
							<td class="td-text">接收服务机构：</td>
							<td class="td-content">
								<span id="JSFWJG" class="fwgl" style="display:block;height:30px;width:200px;text-overflow:ellipsis;white-space:nowrap;overflow: hidden;-o-text-overflow:ellipsis;"></span>
							</td>
							<td class="td-text">预期服务时间：</td>
							<td class="td-content">
								<span id="YQFWSJ" class="fwgl"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">服务项：</td>
							<td class="td-content" colspan="5">
								<span id="FWMC" class="fwgl"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">服务内容：</td>
							<td class="td-content" colspan="5">
								<span id="FWNR" class="fwgl"></span>
							</td>
						</tr>
						<tr id="BLTR">
							<td class="td-text">病例选择：</td>
							<td class="td-content" colspan="5">
								<span id="BLXZ" class="fwgl"></span>
							</td>
						</tr>
						<tr>
							<td class="td-text">备注：</td>
							<td class="td-content" colspan="5">
								<span id="BZ" class="fwgl"></span>
							</td>
						</tr>
					</table>
					<h4 class="h4-title" style="font-size: 13px;">
						服务讨论
					</h4>
					<table class="form-table tlTable">
						<tbody id="fwtlTbody">
							
						</tbody>
						<tfoot>
							<tr>
								<td class="td-text">医生姓名：</td>
								<td class="td-content">
									<input id="YSXM"  readonly="readonly">
									<input id=method" name="method" style="display:none;" value="fwtl"/>
									<input id="YSID" name="YSID" style="display:none;">
									<input id="FWGLID" name="FWGLID" style="display:none;">
								</td>
								<td class="td-text">所在医疗机构：</td>
								<td class="td-content">
									<input id="YLJGMC"  readonly="readonly">
									<input id="YLJGID" name="YLJGID" style="display:none;">
								</td>
								<td class="td-text">讨论时间：</td>
								<td class="td-content">
									<input id="TLSJ"  name="TLSJ"  readonly="readonly">
								</td>
							</tr>
							<tr>
								<td class="td-text">讨论内容：</td>
								<td class="td-content" colspan="5">
									<input id="TLNR" name="TLNR" class="fwtl" type="text" style="width:98%;">
								</td>
							</tr>
							<tr>
								<td class="td-text">备注：</td>
								<td class="td-content" colspan="5">
									<input id="TLBZ" name="TLBZ" class="fwtl" type="text" style="width:98%;">
								</td>
							</tr>
						</tfoot>
					</table>
				</form>
			</div>
		</div>
		<div  region="south" style="border: none; overflow: hidden;text-align:center">
			<button class="btn"  type="button" id="btnSave">提交</button>
			<button class="btn"  type="button" onclick="btnBackHandler()">返回</button>
		</div>
	</div>
</div>
</body>
<script type="text/html" id="tljl">
<table  class="form-table " style="margin-bottom: 10px;">
<tr>
	<td class="td-text">医生姓名：</td>
	<td class="td-content">
		<span class="YSXM"  ></span>
	<td class="td-text">所在医疗机构：</td>
	<td class="td-content">
		<span class="YLJGMC"></span>
	</td>
	<td class="td-text">讨论时间：</td>
	<td class="td-content">
		<span class="TLSJ"></span>
	</td>
</tr>
<tr>
	<td class="td-text">讨论内容：</td>
	<td class="td-content" colspan="5">
		<span class="TLNR"></span>
	</td>
</tr>
<tr class="bzTr">
	<td class="td-text">备注：</td>
	<td class="td-content" colspan="5">
		<span class="TLBZ" ></span>
	</td>
</tr>
</table>
</script>
</html>


